package com.bit.catmoney;

import android.content.Context;
import android.media.MediaPlayer;

public class CMusic {
	private static boolean isPlay;
	private static CMusic instance = new CMusic();
	private MediaPlayer mp;
	
	private CMusic() {}

	public static CMusic getInstance() {
		return instance ;
	}

	public void loopStart(Context context, int sbBgm) {
		stop();
		mp = MediaPlayer.create(context, sbBgm);
		mp.setLooping(true);
		mp.start();
		isPlay = true;
	}

	public void stop() {
		if (mp == null)
			return;
		isPlay = false;
		mp.stop();
		mp.release();
		mp = null;
		
	}
	public static boolean isPlay(){
		return isPlay;
	}
	
	
}
